import React,{Suspense} from 'react'
import {BrowserRouter,Route,Routes,Navigate} from 'react-router-dom'
import Config from './Config'
interface ly{
    path?:string,
    component?:any,
    to?:any,
    children?:ly[],
}
export default function Vie() {
    const btn=(arr:ly[])=>{
return arr.map((a,b)=>{
    return <Route key={b} path={a.path} element={a.to?<Navigate to={a.to}></Navigate >:<a.component></a.component>}>
        {a.children&&btn(a.children)}
    </Route>
})
    }
  return (
    <BrowserRouter>Vie
    <Suspense fallback='加载'>
    <Routes> {btn(Config)}</Routes>
    </Suspense>
    </BrowserRouter>
  )
}
